Skip to content

normalize request URI and resolve hostname using x-cdn-real-host header#149

Open
ruslanti wants to merge 2 commits into
mainfrom
fix/fastedge-uri-normalize
Open

normalize request URI and resolve hostname using x-cdn-real-host header#149
ruslanti wants to merge 2 commits into
mainfrom
fix/fastedge-uri-normalize

Conversation

@ruslanti

Copy link
Copy Markdown
Collaborator

No description provided.

@ruslanti ruslanti requested a review from Copilot June 16, 2026 13:15
@ruslanti ruslanti self-assigned this Jun 16, 2026
@ruslanti ruslanti added the bug Something isn't working label Jun 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the HTTP executors to (1) use the x-cdn-real-host header for determining the effective host and (2) normalize origin-form (relative) request URIs into absolute URIs so guest code consistently observes scheme + authority.

Changes:

  • Switch wasi-http hostname resolution from SERVER_NAME_HEADER to X_CDN_REAL_HOST.
  • Add origin-form URI normalization in the non-wasi HTTP executor, intended to mirror wasi-http behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
crates/http-service/src/executor/wasi_http.rs Uses x-cdn-real-host for hostname resolution in URI normalization, replacing the prior SERVER_NAME_HEADER usage.
crates/http-service/src/executor/http.rs Adds hostname resolution and origin-form → absolute URI normalization for the non-wasi executor to align guest-visible URI shape with wasi-http.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/http-service/src/executor/http.rs Outdated
Comment thread crates/http-service/src/executor/wasi_http.rs Outdated
Comment thread crates/http-service/src/executor/http.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

crates/http-service/src/executor/wasi_http.rs:85

  • Even with the fallback logic above, hostname.parse().ok() can still leave uparts.authority as None; with uparts.scheme set this makes Uri::from_parts return an error. Consider making authority assignment infallible (e.g., last-resort fallback to a static authority) so a bad/unsupported hostname cannot take down request execution.
        if parts.uri.scheme().is_none() {
            let mut uparts = parts.uri.clone().into_parts();
            uparts.scheme = Some(::http::uri::Scheme::HTTP);
            if uparts.authority.is_none() {
                uparts.authority = hostname.parse().ok()
            }
            parts.uri = Uri::from_parts(uparts)?;
        }

Comment thread crates/http-service/src/executor/wasi_http.rs Outdated
Comment thread crates/http-service/src/executor/http.rs Outdated
Comment thread crates/http-service/src/executor/http.rs Outdated
@ruslanti ruslanti force-pushed the fix/fastedge-uri-normalize branch from 46992c3 to 320ca05 Compare June 16, 2026 13:51
@ruslanti ruslanti requested a review from qrdl June 16, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants